#include <string.h>

int strncmp( const char * first, const char * last, size_t count ) {
  if( !count ) {
    return( 0 );
  }
  while( --count && *first && *first == *last ) {
    first++;
    last++;
  }
  return( *first - *last );
}
